<template>
  <div class="dashboard-editor-container">
    <div class=" clearfix">
      <pan-thumb image="https://dhszzp.top/image/xiaohui.jpg" style="float: left">
        你的状态:
        <span class="pan-info-roles">{{ title }}</span>
      </pan-thumb>
      <div class="info-container">
        <span class="display_name" >{{ postForm.enroll_adminuser }}</span>
        <span style="margin-top:10px;font-size:20px;float:left;line-height:40px">考生你好，欢迎报考德宏师范高等专科学校。报名步骤：
          <el-tag type="success" style="font-size:20px;">报名并提交:</el-tag>报名信息→开始报名→选择岗位→保存并提交；
          <el-tag type="success" style="font-size:20px;">查看报名信息:</el-tag>报名信息→查看和修改报名信息→查看；
          <el-tag type="danger" style="font-size:20px;">审核不通过:</el-tag>报名信息→查看和修改报名信息→修改→修改并提交。</span>
          <span style="margin-top:10px;font-size:20px;float:left;line-height:40px"><el-tag type="danger" style="font-size:20px;">注意:</el-tag>1.为了保障报名工作顺利开展，建议考生使用谷歌Chrome浏览器进行报名，上传证明材料图片不超过1MB，除身份证、毕业证、学位证和证明材料外非必要不要上传其它资料。2.初审通过后，不能修改报名信息，否则报名状态变为已提交并重新审核。3.具体考试时间及后续安排，请关注学校官网发布公告。</span>
      </div>
    </div>
    <el-row :gutter="20" style="margin-top:50px">
      <el-col :span="3"><div class="grid-content bg-purple" style="font-size:20px;">报名状态:</div></el-col>
      <el-col :span="21">
        <div class="grid-content bg-purple">
          <el-steps :active="active" align-center :finish-status=finish_status simple>
            <el-step :title=title >
            </el-step>
            <el-step title="已提交" ></el-step>
            <el-step title="初审通过" ></el-step>
          </el-steps>
        </div>
      </el-col>
    </el-row>
    <el-row :gutter="20" style="margin-top:20px">
      <el-col :span="3"><div class="grid-content bg-purple" style="font-size:20px;">审核说明:</div></el-col>
      <el-col :span="21" >
        <el-alert
          :title=description
          :type=finish_status
          :closable="false"
          show-icon
          >
        </el-alert>
      </el-col>
    </el-row>
  </div>
</template>

<script>
// eslint-disable-next-line
/* eslint-disable */ 
import { mapGetters } from 'vuex'
import PanThumb from '@/components/PanThumb'
import GithubCorner from '@/components/GithubCorner'
import { getOneExamine ,listExamine } from '../../../api/enroll'
import Cookies from 'js-cookie'

export default {
  //inject:['reload'],
  name: 'DashboardEditor',
  components: { PanThumb, GithubCorner },
  data() {
    return {
      //emptyGif: 'https://wpimg.wallstcn.com/0e03b7da-db9e-4819-ba10-9016ddfdaed3',
      active:1,
      listQuery:{},
      title:'',
      list:{examine_explain:'',examine_status:''},
      postForm:{},
      finish_status:"error",
      description:"考生还没有提交报名表，请到左侧报名信息栏目中选择开始报名，完成后点击保存并提交，等待审核。"
    }
  },
  computed: {
    ...mapGetters([
      'name',
      'avatar',
      'roles'
    ])
  },
  mounted(){
     this.status()
     this.open4()
    //this.$forceUpdate();
  },
  //vue组件切换时触发
  activated(){
    this.status()
  },
  methods: {
    open4() {
        const h = this.$createElement;
        this.$msgbox({
          title: '2023年德宏师范高等专科学校公开招聘人员公告',
          message: h('p', null, [
            
            
            h('p', { style: 'margin-left: 30px;' }, [h('span',{ style: 'font-weight:bold' },'网上报名时间：'),h('span',null,'2023年3月30日9:00至2023年4月6日18:00')]),
            h('p', { style: 'margin-left: 30px;' }, [h('span',{ style: 'font-weight:bold' },'资格初审时间：'),h('span',null,'2023年3月30日9:00至2023年4月7日18:00')]),
            h('p', { style: 'margin-left: 30px;' }, [h('span',{ style: 'font-weight:bold' },'准考证领取时间：'),h('span',null,'2023年4月14日9:00-17:00')]),
            h('span', { style: 'margin-left: 30px;font-weight:bold' }, '后续相关注意事项见德宏师范高等专科学校网站公告，请报考人员及时关注。'),
            h('p', { style: 'text-align:right;margin-top:40px' }, '德宏师范高等专科学校'),
            h('p', { style: 'text-align:right' }, '2023年3月20日'),
            ]
          ),
          showCancelButton: true,
          confirmButtonText: '已阅',
          cancelButtonText: '关闭',
          beforeClose: (action, instance, done) => {
            if (action === 'confirm') {
              instance.confirmButtonLoading = true;
              instance.confirmButtonText = '执行中...';
              setTimeout(() => {
                done();
                setTimeout(() => {
                  instance.confirmButtonLoading = false;
                }, 300);
              }, 300);
            } else {
              done();
            }
          }
        }).then(action => {
          this.$message({
            type: 'success',
            message: '考生已阅'
          });
        });
      },
    status(){
      let usernameinfo=Cookies.get('username')
    //let usernameinfo=Cookies.get('username')
    //console.log(usernameinfo)
    //console.log(this.token)
    this.listQuery.enroll_adminuser=usernameinfo
    this.postForm.enroll_adminuser=usernameinfo
    listExamine(this.listQuery).then(response => {
        //console.log(response)
        const list = response.data[0]
        this.list = list
        //console.log(this.list.examine_status)
        this.description=this.list.examine_explain
        //判断审核状态
        //console.log(this.list.examine_status)
        switch(this.list.examine_status)
          {
              case "审核不通过":
                  this.active=1
                  this.title="审核不通过"
                  this.finish_status="error"
                  break;
              case "已提交":
                  this.active=2
                  this.title="已报名"
                  this.finish_status="success"
                  break;
              case "初审通过":
                  this.active=3
                  this.title="已报名"
                  this.finish_status="success"
                  break;
              default:
                  this.active=1
                  this.title="未报名"
                  this.finish_status="error"
          }
        const fileName = usernameinfo
        getOneExamine(fileName).then(response1 => {
        //console.log(response1)
        this.postForm=response1.data
        
      })
      }).catch(() => {
        this.active=1
        this.title="未报名"
        this.finish_status="error"
      })
      //this.reload()
    }
  }
}
</script>

<style lang="scss" scoped>
  .emptyGif {
    display: block;
    width: 45%;
    margin: 0 auto;
  }

  .dashboard-editor-container {
    background-color: #ffffff;
    min-height: 100vh;
    padding: 50px 60px 0px;
    .pan-info-roles {
      font-size: 22px;
      line-height: 60px;
      font-weight: 700;
      color: #333;
      display: block;
    }
    .info-container {
      position: relative;
      margin-left: 190px;
      height: 150px;
      //line-height: 200px;
      .display_name {
        font-size: 48px;
        line-height: 78px;
        color: #212121;
        position: relative;
        top: 25px;
      }
    }
  }
</style>
